﻿<%@ Page Title="" Language="C#" MasterPageFile="~/FYPSite.Master" AutoEventWireup="true"
    CodeBehind="WebFormDay.aspx.cs" Inherits="JsonServer.WebFormDay" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <form id="form1" runat="server">
    <div style="height: 650px; background-color: #00FF00;">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanelOfMonthPage" runat="server">
        <ContentTemplate>
            <asp:ObjectDataSource ID="DataSourceFromTable" runat="server" DeleteMethod="Delete"
                InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByDay"
                TypeName="JsonServer.FYPDataSetTableAdapters.FYPPowerTableTableAdapter" UpdateMethod="Update">
                <DeleteParameters>
                    <asp:Parameter Name="Original_Id" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="Power" Type="String" />
                    <asp:Parameter Name="CreateDate" Type="String" />
                </InsertParameters>
                <SelectParameters>
                    <asp:ControlParameter ControlID="TextBoxOfDayPageYear" Name="YEAR" PropertyName="Text"
                        Type="String" />
                    <asp:ControlParameter ControlID="TextBoxOfDayPageMonth" Name="MONTH" PropertyName="Text"
                        Type="String" />
                    <asp:ControlParameter ControlID="TextBoxOfDayPageDay" Name="DAY" PropertyName="Text"
                        Type="String" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Power" Type="String" />
                    <asp:Parameter Name="CreateDate" Type="String" />
                    <asp:Parameter Name="Original_Id" Type="Int32" />
                </UpdateParameters>
            </asp:ObjectDataSource> <br /> <br /> <br />
            &nbsp;&nbsp;&nbsp;&nbsp; Year:<br />
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:TextBox ID="TextBoxOfDayPageYear" runat="server" Style="text-align: left" Width="245px"
                MaxLength="4"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidatorForYear" runat="server"
                ControlToValidate="TextBoxOfDayPageYear" ErrorMessage="Invalid Year value" ValidationExpression="\d{4}$">*</asp:RegularExpressionValidator>
            <asp:RequiredFieldValidator ID="RequiredFieldValidatorForYear" runat="server" ControlToValidate="TextBoxOfDayPageYear"
                ErrorMessage="Please input year value" ForeColor="Black">*</asp:RequiredFieldValidator>
            <asp:Button ID="ButtonCalculateDayPower" runat="server" Text="Calculate" OnClick="ButtonCalculateDayPower_Click"
                Style="z-index: 1; left: 620px; top: 180px; position: absolute; height: 50px;
                width: 251px" />
            <br />
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp; Month:<br />
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:TextBox ID="TextBoxOfDayPageMonth" runat="server" Width="246px" MaxLength="2"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidatorForMonth" runat="server"
                ControlToValidate="TextBoxOfDayPageMonth" ErrorMessage="Invalid Month value"
                ValidationExpression="\d{2}$">*</asp:RegularExpressionValidator>
            <asp:RequiredFieldValidator ID="RequiredFieldValidatorForMonth" runat="server" ControlToValidate="TextBoxOfDayPageMonth"
                ErrorMessage="Please input month value" ForeColor="Black">*</asp:RequiredFieldValidator>
            <br />
            &nbsp;&nbsp;<br />
            &nbsp;&nbsp;&nbsp; &nbsp;day:<br />
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:TextBox ID="TextBoxOfDayPageDay" runat="server" Width="245px" MaxLength="2"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidatorForDay" runat="server"
                ControlToValidate="TextBoxOfDayPageDay" ErrorMessage="Invalid Day value" ValidationExpression="\d{2}$">*</asp:RegularExpressionValidator>
            <asp:RequiredFieldValidator ID="RequiredFieldValidatorForDay" runat="server" ControlToValidate="TextBoxOfDayPageDay"
                ErrorMessage="Please input day value" ForeColor="Black">*</asp:RequiredFieldValidator>
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <br />
            <br />
            <br />
            <asp:Label ID="LabelDayPower" runat="server" Style="z-index: 1; left: 617px; top: 263px;
                position: absolute; height: 20px;"></asp:Label>
            <br />
            <br />
            <asp:ValidationSummary ID="ValidationSummary" runat="server" ForeColor="Red" Style="z-index: 1;
                left: 580px; top: 326px; position: absolute; height: 32px; width: 297px" />
            &nbsp;&nbsp;
            <asp:Chart ID="DayChart" runat="server" DataSourceID="DataSourceFromTable" Style="text-align: center;
                z-index: 1; left: 350px; top: 403px; position: absolute; " Width="298px"
                BackImageAlignment="TopRight">
                <Series>
                    <asp:Series Name="Series1" ChartType="Spline" XValueMember="CreateDate" YValueMembers="Power"
                        ChartArea="ChartArea1">
                    </asp:Series>
                </Series>
                <ChartAreas>
                    <asp:ChartArea Name="ChartArea1">
                    </asp:ChartArea>
                </ChartAreas>
            </asp:Chart>
            <br />
            <br />
            <br />
            <asp:GridView ID="DayOfPowerGridView" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" DataKeyNames="Id" 
                DataSourceID="DataSourceFromTable" CellPadding="4" ForeColor="#333333" 
                GridLines="None" Width="250px"
                Style="z-index: 1; left: 679px; top: 405px; position: absolute; height: 299px;
                width: 250px">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" ReadOnly="True" />
                    <asp:BoundField DataField="Power" HeaderText="Power" SortExpression="Power" />
                    <asp:BoundField DataField="CreateDate" HeaderText="CreateDate" SortExpression="CreateDate" />
                </Columns>
                <EditRowStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#EFF3FB" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
    </div>
    </form>
</asp:Content>
